﻿using System;

namespace Songhay.Office2010.Word
{
    using Songhay.Models;

    /// <summary>
    /// Defines a Composition Message
    /// for an action producing a transformation
    /// of <see cref="System.String"/> data.
    /// </summary>
    public class TransformationMessage : IControlInteractionMessage
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TransformationMessage"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        public TransformationMessage(IControlInteractionMessage message)
        {
            if(message == null)
                throw new ArgumentNullException("message",
                    "The base message is null.");
            this.InnerMessage = message;
            this.ControlValue = message.ControlValue;
            this.ControlId = message.ControlId;
            this.ControlTag = message.ControlTag;
        }

        /// <summary>
        /// Gets or sets the transformation result.
        /// </summary>
        /// <value>The transformation result.</value>
        public string TransformationResult { get; set; }

        /// <summary>
        /// Gets or sets the inner message.
        /// </summary>
        /// <value>The inner message.</value>
        public IControlInteractionMessage InnerMessage { get; set; }

        #region IControlInteractionMessage Members

        /// <summary>
        /// Gets or sets the control value.
        /// </summary>
        /// <value>The control value.</value>
        public object ControlValue { get; set; }

        /// <summary>
        /// Gets or sets the control id.
        /// </summary>
        /// <value>The control id.</value>
        public string ControlId { get; set; }

        /// <summary>
        /// Gets or sets the control tag.
        /// </summary>
        /// <value>The control tag.</value>
        public string ControlTag { get; set; }

        #endregion
    }
}
